<div class="main-content">
	<div class="breadcrumbs" id="breadcrumbs">
		<script type="text/javascript">
			try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
		</script>

		
	</div>
	<!-- Main content -->
	<div class="page-content">
    	<div class="row">
    	    <div class="page-header">
    			<h1>结算管理列表</h1>
    		</div>
    		<div class=" col-md-12 col-sm-12 col-xs-12 form">
                <div class="row">
                <form action="<?php echo base_url().'admin/gasstation/settlement/'.$gasstation_id?>" method="get">
                    <div class="wh">
                    	<label>交易时间：</label>
                        <input type="text" id="date1" name="date1" value="<?php if (isset($date1))echo $date1;?>" style="width:60%;"/>
                    </div>
                     <div class="wh">
                    	<label>到</label>
                        <input type="text" id="date2" name="date2" value="<?php if (isset($date2))echo $date2;?>" style="width:60%;"/>
                    </div>
                    <div class="wh">
                        <button class="btn btn-sm btn-info" type="submit"><i class="icon-search"></i>查询</button>
                    </div> 
                </form>
                </div>
            </div>
            <input type="hidden" name="upid" id="upid" value=""/>
            <div class="col-xs-12 margin_t margin_b">
				<div class="table-responsive  tab">
					<table id="sample-table-1" class="table table-striped table-bordered table-hover">
						<thead>
							<tr>
			      				<th>结算日期</th>
			      				<th>订单总额</th>
								<th>总额(不需要服务费)</th>
								<th>总额(需要服务费)</th>
			      				<th>营销费用</th>
			      				<th>折后金额</th>
			      				<th>服务费</th>
                                <th>油站优惠券</th>
			      				<th>转账<br/>金额（元）</th>
                                <th>自动提现状态</th>
                                <th>操作</th>
							</tr>
						</thead> 
						<tbody>
						<?php if (isset($money_arrray_val)&&count($money_arrray_val)>0){
                            	foreach ($money_arrray_val as $app){
                            	?>
							<tr>
			      				<td><?php echo $app['date'];?></td>
			      				<td><?php echo $app['order_price'];?></td>
								<td><?php echo $app['nfuwu_total_price'];?></td>
								<td><?php echo $app['fuwu_total_price'];?></td>
			      				<td><?php echo $app['yx_price'];?></td>
			      				<td><?php echo $app['zhe_price'];?></td>
			      				<td><?php echo $app['service_price'];?></td>
                                <td><?php echo $app['gasstation_coupon_price'];?></td>
			      				<td><?php echo $app['real_price'];?></td>
                                <td><p><?php if ($app['date']<date('Y-m-d')) {
                                        if($app['type'] == 0){
                                    ?>
                                		<button class="btn btn-sm btn-info" onclick='up_data("<?php echo $app['date'];?>")' type="button">结算</button></p></td>
                                	<?php }elseif($app['type'] == 1){ ?>
                                		<button class="btn btn-sm"  type="button" disabled>已结算</button></p></td>
                                	<?php }
                                }else{
                                    echo '...';
                                    } ?>
                                <td><p><button class="btn btn-danger btn-sm" onclick='prompt("<?php echo $app['date'];?>")' type="button"><i class="icon-bar-chart"></i>导出</button></p></td>
    						</tr>
    						
    						<?php }
                            }else{?>
                            <tr>
                            	<td colspan="14">无数据</td>
                            </tr>
                            <?php }?>
                            </tbody>
                         </table>
                     </div><!-- /.table-responsive -->
				</div>
                <div class="col-sm-12">
                	<div class="modal-footer no-margin-top">
	                	<div class="pull-left record">
							共<?php echo $count;?>条记录
	                   </div>
                	</div>
                </div>
            </div><!-- /.row -->
		</div><!-- /.page-content -->
	</div><!-- /.main-content -->
		<div id="promptModal" class="modal fade" role="dialog" aria-hidden="true" >
		<div class="modal-content" style="width: 360px; top: 180px; left: 35%;" >
			<form class="layui-form" action="<?php echo base_url().'admin/gasstation/settlement_up_time/'.$gasstation_id;?>" method = "get">
				<div class="modal-header">
				  <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
				  <h3>提示信息</h3>
				</div>
				<div class="modal-body">
				  <p>确定核算该条数据？</p>
				  <input name="time" type="hidden" id="a" value="" />
				</div>
				<div class="modal-footer">
				  <button class="btn btn-danger" type="submit" lay-submit lay-filter="formDemo">确定</button>
				  <a href="#" class="btn btn-info" data-dismiss="modal" aria-hidden="true">取消</a>
				</div>
			</form>
		</div>
	</div>
	<div id="promptModal_tow" class="modal fade" role="dialog" aria-hidden="true" >
		<div class="modal-content" style="width: 360px; top: 180px; left: 35%;" >
			<form class="layui-form" action="<?php echo base_url().'admin/gasstation/settlement_up_execl/'.$gasstation_id;?>" method = "get">
				<div class="modal-header">
				  <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
				  <h3>提示信息</h3>
				</div>
				<div class="modal-body">
				  <p>确定导出当前查询信息为EXCEL？</p>
				  <input name="date" type="hidden" id="c" value="" />
				</div>
				<div class="modal-footer">
				  <button class="btn btn-danger" type="submit" lay-submit lay-filter="formDemo">确定</button>
				  <a href="#" class="btn btn-info" data-dismiss="modal" aria-hidden="true">取消</a>
				</div>
			</form>
		</div>
	</div>
	<script type="text/javascript">
    $(function () {
        $('#date1').datetimepicker({
            format: 'yyyy-mm-dd', 'autoclose': true, minView: 2,language: 'zh-CN'
        });
        $('#date2').datetimepicker({
            format: 'yyyy-mm-dd', 'autoclose': true, minView: 2,language: 'zh-CN'
        });
    });
	</script>
	<script>
	function up_data(time){
		$("#a").attr('value',time);
	    $('#promptModal').modal('show');
	}
	function prompt(time){
		$("#c").attr('value',time);
	    $('#promptModal_tow').modal('show');
	}
	</script>